package nc.hdysc.engine.impl.ordersplit;

import java.util.HashMap;
import java.util.Map;

import nc.bs.dao.BaseDAO;
import nc.hdysc.engine.itf.ordersplit.IOrderSplitConf;
import nc.vo.hdysc.scenery.SceneryVO;
import nc.vo.logging.Debug;

public class SceneryConf implements IOrderSplitConf<SceneryVO> {

	private Map<String, SceneryVO> sceneryCache;

	private BaseDAO dao;

	private BaseDAO getDAO() {
		if (dao == null) {
			dao = new BaseDAO();
		}
		return dao;
	}

	public SceneryVO getConf(String key) {
		try {
			if (sceneryCache == null) {
				sceneryCache = new HashMap<String, SceneryVO>();
			}
			if (!sceneryCache.containsKey(key)) {
				SceneryVO scenery = (SceneryVO) getDAO().retrieveByPK(SceneryVO.class, key);
				sceneryCache.put(key, scenery);
			}
		} catch (Exception e) {
			Debug.error(e);
		}
		return sceneryCache.get(key);
	}

}
